package com.cindata

import com.cindata.dictionary.*

class OtherCollateral
{

    Province province
    City city
    District district
    EstateStatusDict estateStatus
    Boolean isEstate = true
    BigDecimal unitPrice
    // 评估单价
    BigDecimal totalPrice
    // 评估总价
    Date valuationDate
    // 评估时间
    BigDecimal ltv
    // 抵押率 （%）
    BigDecimal cltv
    // 动态抵押率 （%）
    Account account
    // 直属管理机构(银行网点)
    Mortgage mortgage
    // 贷款
    MortgageStatusDict mortgageStatus

    String externalId
    // 质押物编号
    OtherCollateralTypeDict type
    // 质押物类型
    ManagementRightsType rightsType
    // 知识产权类型
    String name
    // 质押物名称
    String ownershipNumber
    // 所有权编号
    String fullName
    // 出质人名称
    ContactIdentityType identityType
    // 出质人证件类型
    String idNumber
    // 出质人证件号码
    String loanCardNumber
    // 出质人贷款卡编号
    String commonOwnerFullName
    // 其他共同所有人
    Double sharePoint
    // 所占份额

    // 仓单
    String goodsName
    // 货物名称/动产名称
    String goodsUnit
    // 货物规格/动产规格
    Integer goodsAmount
    // 货物数量/动产数量
    Double goodsValue
    // 货物价值/动产价值
    String storeCompany
    // 仓储公司名称
    String exchangeAccount
    // 标准仓单所属交易所
    String guarantee
    // 保险人
    Double guaranteeAmount
    // 保险金额/担保价值
    Integer guaranteeDuration
    // 保险期限

    // 提货
    CurrencyDict currency
    // 币种
    String deliveryAddress
    // 提货地点
    String supplierName
    // 供应商名称
    String billType
    // 提单类别
    String shipper
    // 托运人
    String receiver
    // 收货人
    String receiverAddress
    // 收货人地址
    String sender
    // 发货人
    String senderAddress
    // 发货人地址
    String billOwner
    // 提单持有人
    String goodsOwner
    // 货物所有人	文本框	手工输入	字符	否	　
    String carrier
    // 承运人
    Double weight
    // 总毛重
    Double volume
    // 体积
    String freightType
    // 运费类型	1预付 2到付
    Double freightTotalPrice
    // 总运费

    // 存货
    Date startDate
    // 仓单/提货单出具日期/存放起始日期/存放日期  权利起始日期
    Date endDate
    // 赎货截止日期/仓单到期日期/提单到期日期/到期日期  权利到期日期
    String billNumber
    // 仓单/提货单编号/仓单号码/提单号码
    String storehouseName
    // 仓储方名称
    Boolean isExportUnderSupervise = false
    // 是否输出监管
    String storehouseAddress
    // 质物仓储地点/存放地点/动产存放地址
    String acceptanceNumber
    // 入库验收单号
    String warehouseNumber
    // 仓储货位号
    String pledgeStorageDate
    // 质物入库日期
    String pledgeDetail
    // 质物详细品名
    String pledgeSpecification
    // 质物规格
    String pledgeModel
    // 质物型号
    String pledgeLevel
    // 质物等级
    Double pledgeMinPrice
    // 质物最低价值
    Integer pledgeMinAmount
    // 质物最低数量
    String valuationUnit
    // 计价单位
    Integer pledgeAmount
    // 出质数量
    BigDecimal pledgeUnitPrice
    // 出质价格
    BigDecimal pledgeTotalPrice
    // 出质价值	出质价值=出质数量*出质价格
    String marktoMarket
    // 盯市关联
    Double rangeOffluctuation
    // 价格波动范围(元)
    String isPurchaseInsurance
    // 是否购买保险
    String guardLineValue
    // 警戒线设定值
    String flatLineValue
    // 平仓线设定值

    // 其他动产质押物
    String custodian
    // 保管人名称

    // 经营权
    String warrantNumber
    // 权证号码
    String warrantName
    // 权证名称 权利名称
    String warrantAccount
    // 权利批准机构

    // 知识产权-注册商标专用权
    String brandLevel
    // 商标级别 1 普通 2 知名 3 著名 4 弛名
    Boolean isFirstMortgage = false
    // 是否第一质押权人 1 是，2 否
    String registerNumber
    // 登记号

    // 知识产权-专利权

    // 知识产权-著作权

    // 其他权利质押物

    Cashability cashability
    // 变现能力 1.通用且变现容易，2.通用但变现较不易，专用性强
    String valueVolatility
    // 价值波动性 1.价值波动大；2.价值波动中；3.有升值潜力或波动小
    String seizureOfConvenience
    // 查封便利性 1.无查封障碍的不动产，动产由我行监管；2.查封有一定障碍的不动产，动产存放地点相对固定但非我行监管；3.查封有障碍的不动产，动产存放地点难掌握和控制
    String relationOfMortgagor
    // 抵质押物与借款人相关性 1.本人 2.第三方
    String legalValidity
    // 法律有效性 1.担保合法且手续完整 2.担保不合法或手续基本无效
    Double firstEvaluatePrice
    // 初次评估价值
    Account firstEvaluateAccount
    // 初次评估机构
    Double latestEvaluatePrice
    // 最新评估价值
    Account latestEvaluateAccount
    // 最新评估机构
    Date latestEvaluateDate
    // 最新评估日期
    Date nextEvaluateDate
    // 下次评估日期
    Double actualMortgageRate
    // 实际抵质押率 (实际抵质押率=债权本息总额÷抵押物评估价值（或质押物认定价值）×100%)
    Double mortgageRateUpperLimit
    // 抵质押率上限
    String description
    // 抵质押物说明/权利简要说明
    String registerFullName
    // 登记人
    String registerAccount
    // 登记机构
    Date registerDate
    // 登记日期
    Date registerUpdateDate
    // 更新日期

    Date createdDate = new Date()
    Date modifiedDate = new Date()
    User user
    User createBy
    User modifyBy

    static mapping = {
        autowire true
    }

    static constraints = {

        province nullable: true, blank: true, comment: '省份'
        city nullable: true, blank: true, comment: '城市'
        district nullable: true, blank: true, comment: '区县'
        estateStatus nullable: true, blank: true, comment: '贷款状态'
        isEstate nullable: true, blank: true, comment: '是否在押'
        unitPrice nullable: true, blank: true, comment: '评估单价'
        totalPrice nullable: true, blank: true, comment: '评估总价'
        valuationDate nullable: true, blank: true, comment: '评估时间'
        ltv nullable: true, blank: true, comment: '抵押率 （%）'
        cltv nullable: true, blank: true, comment: '动态抵押率 （%）'
        account nullable: true, blank: true, comment: '属管理机构(银行网点)'
        mortgage nullable: true, blank: true, comment: '贷款'
        mortgageStatus nullable: true, blank: true, comment: '贷款状态'

        externalId maxSize: 50, nullable: true, blank: true, comment: '质押物编号'
        type nullable: true, blank: true, comment: '质押物类型'
        name maxSize: 50, nullable: true, blank: true, comment: '质押物名称'
        ownershipNumber maxSize: 50, nullable: true, blank: true, comment: '所有权编号'
        fullName maxSize: 20, nullable: true, blank: true, comment: '出质人名称'
        identityType nullable: true, blank: true, comment: '出质人证件类型'
        idNumber maxSize: 18, nullable: true, blank: true, comment: '出质人证件号码'
        loanCardNumber maxSize: 50, nullable: true, blank: true, comment: '出质人贷款卡编号'
        commonOwnerFullName maxSize: 20, nullable: true, blank: true, comment: '其他共同所有人'
        sharePoint nullable: true, blank: true, comment: '所占份额'


        goodsName maxSize: 50, nullable: true, blank: true
        goodsUnit maxSize: 50, nullable: true, blank: true
        goodsAmount nullable: true, blank: true
        goodsValue nullable: true, blank: true
        storeCompany maxSize: 50, nullable: true, blank: true
        exchangeAccount maxSize: 50, nullable: true, blank: true
        guarantee maxSize: 50, nullable: true, blank: true
        guaranteeAmount nullable: true, blank: true
        guaranteeDuration nullable: true, blank: true

        currency nullable: true, blank: true
        deliveryAddress maxSize: 150, nullable: true, blank: true
        supplierName maxSize: 50, nullable: true, blank: true
        billType maxSize: 50, nullable: true, blank: true
        shipper maxSize: 50, nullable: true, blank: true
        receiver maxSize: 50, nullable: true, blank: true
        receiverAddress maxSize: 150, nullable: true, blank: true
        sender maxSize: 50, nullable: true, blank: true
        senderAddress maxSize: 150, nullable: true, blank: true
        billOwner maxSize: 50, nullable: true, blank: true
        goodsOwner maxSize: 50, nullable: true, blank: true
        carrier maxSize: 50, nullable: true, blank: true
        weight nullable: true, blank: true
        volume nullable: true, blank: true
        freightType maxSize: 50, nullable: true, blank: true
        freightTotalPrice nullable: true, blank: true

        custodian maxSize: 50, nullable: true, blank: true

        warrantNumber maxSize: 50, nullable: true, blank: true
        warrantName maxSize: 50, nullable: true, blank: true
        warrantAccount maxSize: 50, nullable: true, blank: true

        brandLevel maxSize: 50, nullable: true, blank: true
        isFirstMortgage nullable: true, blank: true
        registerNumber maxSize: 50, nullable: true, blank: true

        startDate nullable: true, blank: true, comment: '仓单/提货单出具日期'
        billNumber maxSize: 50, nullable: true, blank: true, comment: '仓单/提货单编号'
        storehouseName maxSize: 50, nullable: true, blank: true, comment: '仓储方名称'
        isExportUnderSupervise nullable: true, blank: true, comment: '是否输出监管'
        storehouseAddress maxSize: 150, nullable: true, blank: true, comment: '质物仓储地点'
        acceptanceNumber maxSize: 50, nullable: true, blank: true, comment: '入库验收单号'
        warehouseNumber maxSize: 50, nullable: true, blank: true, comment: '仓储货位号'
        pledgeStorageDate nullable: true, blank: true, comment: '质物入库日期'
        pledgeDetail maxSize: 50, nullable: true, blank: true, comment: '质物详细品名'
        pledgeSpecification maxSize: 50, nullable: true, blank: true, comment: '质物规格'
        pledgeModel maxSize: 50, nullable: true, blank: true, comment: '质物型号'
        pledgeLevel maxSize: 50, nullable: true, blank: true, comment: '质物等级'
        pledgeMinPrice nullable: true, blank: true, comment: '质物最低价值'
        pledgeMinAmount nullable: true, blank: true, comment: '质物最低数量'
        valuationUnit maxSize: 50, nullable: true, blank: true, comment: '计价单位'
        pledgeAmount nullable: true, blank: true, comment: '出质数量'
        pledgeUnitPrice nullable: true, blank: true, comment: '出质价格'
        pledgeTotalPrice nullable: true, blank: true, comment: '出质价值'
        marktoMarket maxSize: 50, nullable: true, blank: true, comment: '盯市关联'
        rangeOffluctuation nullable: true, blank: true, comment: '价格波动范围'
        isPurchaseInsurance nullable: true, blank: true, comment: '是否购买保险'
        endDate nullable: true, blank: true, comment: '赎货截止日期'
        guardLineValue nullable: true, blank: true, comment: '警戒线设定值'
        flatLineValue nullable: true, blank: true, comment: '平仓线设定值'

        cashability nullable: true, blank: true, comment: '变现能力'
        valueVolatility maxSize: 50, nullable: true, blank: true, comment: '价值波动性'
        seizureOfConvenience maxSize: 50, nullable: true, blank: true, comment: '查封便利性'
        relationOfMortgagor maxSize: 50, nullable: true, blank: true, comment: '抵质押物与借款人相关性'
        legalValidity maxSize: 50, nullable: true, blank: true, comment: '法律有效性'
        firstEvaluatePrice nullable: true, blank: true, comment: '初次评估价值'
        firstEvaluateAccount nullable: true, blank: true, comment: '初次评估机构'
        latestEvaluatePrice nullable: true, blank: true, comment: '最新评估价值'
        latestEvaluateAccount nullable: true, blank: true, comment: '最新评估机构'
        latestEvaluateDate nullable: true, blank: true, comment: '最新评估日期'
        nextEvaluateDate nullable: true, blank: true, comment: '下次评估日期'
        actualMortgageRate nullable: true, blank: true, comment: '实际抵质押率'
        mortgageRateUpperLimit nullable: true, blank: true, comment: '抵质押率上限'
        description maxSize: 512, nullable: true, blank: true, comment: '抵质押物说明'
        registerFullName maxSize: 20, nullable: true, blank: true, comment: '登记人'
        registerAccount maxSize: 50, nullable: true, blank: true, comment: '登记机构'
        registerDate nullable: true, blank: true, comment: '登记日期'
        registerUpdateDate nullable: true, blank: true, comment: '更新日期'

        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
        user nullable: true, blank: true
        createBy nullable: true, blank: true
        modifyBy nullable: true, blank: true

        rightsType nullable: true, blank: true
    }

    def springSecurityService
    def beforeUpdate()
    {
        modifiedDate = new Date()
        def username = springSecurityService?.getPrincipal()?.username
        modifyBy = User.findByUsername(username)
    }

    def beforeInsert()
    {
        def username = springSecurityService?.getPrincipal()?.username
        createBy = User.findByUsername(username)
        account = createBy?.account
    }
}
